/*
 * ExpressionMesh.h
 *
 *  Created on: 13 févr. 2011
 *      Author: elendir
 */

#ifndef EXPRESSIONMESH_H_
#define EXPRESSIONMESH_H_

#include "../xpression-model/Expression.h"
#include "../xpression-model/Variable.h"
#include "../xpression-model/Model.h"

#include <vector>

class ExpressionVertex {
public:
	float x;
	float y;
	float z;
};

class ExpressionColor {
public:
	float r;
	float g;
	float b;
};


class ExpressionMesh {
public:
		ExpressionMesh(Expression* treeBase, Variable* phi, Variable* theta, unsigned int phiStep, unsigned int thetaStep);
		virtual ~ExpressionMesh();
		void Draw();
		void FillVertexBuffer();
		void FillIndexBuffer();
		void FillCartesianCoordinates(ExpressionVertex *vertex, float theta, float phi, float radius);

private:
		// Mesh Data
		int		m_nVertexCount;					// Vertex Count
		std::vector<ExpressionVertex>		m_vVertices;	// Vertex Data
		std::vector<ExpressionColor>		m_vColors;		// Color Data
		std::vector<unsigned int>					m_vIndices;
		Expression *m_expression;	//Expression tree
		Variable *m_phi, *m_theta;  //Angles
		unsigned int m_phiStep, m_thetaStep;
};

#endif /* EXPRESSIONMESH_H_ */
